table.insert(itemActions,
	function(item, action)
		-- RARE circlets rewrite rev 1.1 by Kel. Last update 7.24.08
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 7
		local identify = true
		local dump = true

		if not (item.quality == ItemQuality.Rare and item.baseItem.baseType.Type == ItemKind.Circlet) then 
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodRareCirclet(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodRareCirclet(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodRareCirclet(item) then
			return dump
		end

		return false
	end
)

function isGoodRareCirclet(item)
	local fcr, sk, sktab, frw, strdex, lm, def = false, false, false, false, false, false, false
	-- local sktree  -- huh?!
	for i = 0, item.mods:size() - 1 do
		if item.mods[i].Stat.Type == StatType.FasterCastRate then
			fcr = true
		elseif (item.mods[i].Stat.Type == StatType.ClassSkillsBonus and
			   	item.mods[i].Value >= 2) then
			sk = true
		elseif  (item.mods[i].Stat.Type == StatType.SkillTabBonus and
				item.mods[i].Value >= 2) then --  2 skill tab
			sktab = true
		elseif (item.mods[i].Stat.Type == StatType.FasterMoveVelocity) then
			frw = true
		elseif ((item.mods[i].Stat.Type == StatType.Strength or
				item.mods[i].Stat.Type == StatType.Dexterity) and
				item.mods[i].Value >= 10) then -- 10+ str or dex
			strdex = true
		elseif ((item.mods[i].Stat.Type == StatType.MaxLife or
				item.mods[i].Stat.Type == StatType.MaxMana)
				and item.mods[i].Value >= 40) then -- 40+ life or mana
			lm = true
		elseif (item.mods[i].Stat.Type == StatType.DefensePercent and
				item.mods[i].Value>=101) then -- 101-200% Enhanced Defense (Holy/Godly)
			def = true
		end
	end
	
	return (
			(sk or sktab and (strdex or frw or lm or def)) or -- no fcr. 2 sk + stats,life or mana
			fcr and (sk or sktab) or
			hasCertainSockets(item, "2") or --2os circlets
			hasRes(item, 16, 4) or
			hasRes(item, 21, 3) or
			hasRes(item, 35, 2)
			)
end

--[[

Circlets have TONS of possible good affixes. Most of these still need checks!

Rare Circlets: Good Prefixes
================================================
Affix     	 Level  LvReq  Freq   Stats
================================================
Holy			36	27	216		81-100% Defense
Godly			50	43	50		101-200% Defense
Jagged			1	1	9		10-20% enhanced Damage
Deadly			5	3	45		21-30% enhanced Damage
Platinum		22	16	132		+101-120 to Attack Rating
Visionary		25	18	25		+1% AR per Level
Dragon's		24	18	48		31-40 to Mana
Wyrm's			30	22	60		41-60 to Mana
Great Wyrm		37	29	74		61-90 to Mana
Mnemonic		25	18	25		+0.75 Mana per Level
Scintillating	34	25	170		12-15% all Resistances
Prismatic		42	31	168		16-20% all Resistances
Cobalt			18	13	54		Cold Resist +21-30%
Sapphire		25	18	75		Cold Resist +31-40%
Garnet			18	13	54		Fire Resist +21-30%
Ruby			25	18	75		Fire Resist +31-40%
Coral			18	13	54		Lite Resist +21-30%
Amber			25	18	75		Lite Resist +31-40%
Jade			18	13	54		Psn  Resist +21-30%
Emerald			25	18	75		Psn  Resist +31-40%
Victorious		17	12	68		2-5 Mana after Kill
Arcadian		15	11	30		51-100 AR vs Demons & +26-50% Damage to Demons
Static			25	18	75		1 to 49-120 Lightning Damage
Fiery			25	18	75		16-25 to 31-60 Fire Damage
==============
skill prefixes
==============
Sensei's		40	30	40		+2 Martial Arts (Assassin only)
Blazing			40	30	40		+2 Fire Skills (Sorceress)
HawkBranded		40	30	40 		+2 Offensive Auras (Paladin)
Charged			40	30	40		+2 Lightning Skills (Sorceress)
Psychic			40	30	40		+2 Shadow Disciplines (Assassin)
Mojo			40	30	40		+2 Summoning Skills (Necromancer)
Commander's		40	30	40		+2 Combat Skills (Paladin)
Freezing		40	30	40		+2 Cold Skills (Sorceress)
Warden's		40	30	40		+2 Defensive Auras (Paladin)
Noxious			40	30	40		+2 Poison & Bone Skills (Necromancer)
Veteran's		40	30	40		+2 Combat Skills (Barbarian)
Gymnastic		40	30	40		+2 Passive & Magic Skills (Amazon)
Blighting		40	30	40		+2 Curses (Necromancer)
Terrene			40	30	40		+2 Elemental Skills (Druid)
Trickster's		40	30	40		+2 Traps (Assassin)
Feral			40	30	40		+2 Shapeshifting Skills (Druid)
Caretaker's		40	30	40		+2 Summoning Skills (Druid)
Witch-hunter's	90	67	180		+2 Assassin Skills
Hierophant's	90	67	180		+2 Druid Skills
Berserker's		90	67	180		+2 Barbarian Skills
Arch-Angel's	90	67	180		+2 Sorceress Skills
Necromancer's	90	67	180		+2 Necromancer Skills
Priest's		90	67	180		+2 Paladin Skills
Valkyrie's		90	67	180		+2 Amazon Skills


Rare Circlets: Good Suffixes
================================================
Affix     		 Level  LvReq  Freq   Stats
================================================
of Life				41	33		164	Damage Reduced By 4-7
of Guarding			32	24		128	Magic Damage Reduced By 3
of the Apprentice	5	3		30	10% Faster Cast Rate
of the Magus		29	21		145	20% Faster Cast Rate
of Quality			30	22		120	7 to +8 Max Damage
of Excellence		59	51		236	6 to +9 Min Damage
of Balance			5	3		20	10% Faster Hit recovery
of Regrowth			17	12		68	Replenish Life +6-10
of Wealth			17	12		68	41-80% Goldfind
of Fortune			16	12		64	16-25% Magic Find
of Precision		43	35		129	10 to +15 to Dexterity
of Perfection		59	51		177	16 to +20 to Dexterity
of the Giant		42	34		126	10-15 to Strength
of the Titan		58	50		174	16-20 to Strength
of Atlas			71	63		213	21-30 to Strength
of Sorcery			21	16		63	11-15 to Energy
of Wizardry			31	23		93	16-20 to Energy
of the Tiger		51	43		153	21-30 to Life
of the Mammoth		68	60		204	31-40 to Life
of the Mammoth		25	18		75	31-40 to Life
of the Colossus		30	22		90	41-60 to Life
of the Locust		47	35		188	5-6% Life stolen per Hit
of the Lamprey		77	65		308	7-8% Life Leech
of the Wraith		58	40		232	5-6% Mana Leech
of the Vampire		78	66		312	7-8% Mana Leech
of Pacing			12	8		36	10% faster Run/Walk
of Haste			22	16		88	20% faster Run/Walk
of Speed			37	29		148	30% faster Run/Walk
of Self-Repair		3	1		9	Repairs 1 Durability in 33 Seconds
of Restoration		20	12		40	Repairs 1 Durability in 20 Seconds
of Teleportation	48	48		48	20 Charges of Level 3 Teleport
	
]]--
	